package com.hualan.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hualan.mapper.ConsultBookingMapper;
import com.hualan.pojo.ConsultBooking;
import com.hualan.service.ConsultBookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ConsultBookImpl implements ConsultBookService {
    @Autowired
    private ConsultBookingMapper consultBookingMapper;
    @Override
    public PageInfo<ConsultBooking> findConsultBooking(Integer pageNum, Integer pagesize, String consulttype) {
        //设置分页参数
        PageHelper.startPage(pageNum,pagesize);
        //调用Mapper查询数据
        List<ConsultBooking> consultresult = consultBookingMapper.selectAllByConsultType(consulttype);
        //返回分页参数
        return new PageInfo<>(consultresult);
    }

    @Override
    public int deleteByKey(Long id) {
       return consultBookingMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(ConsultBooking record) {
        return consultBookingMapper.insert(record);
    }

    @Override
    public int deleteBatch(List<Integer> ids) {
        return consultBookingMapper.deleteBatch(ids);
    }


}
